<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>欢迎访问产品运营互动中心！</title>

<script src="<s:url value="/script/jquery_last.js"/>" type="text/javascript"></script>
<script src="<s:url value="/script/formValidator.js"/>" type="text/javascript" charset="UTF-8"></script>
<script src="<s:url value="/script/formValidatorRegex.js"/>" type="text/javascript" charset="UTF-8"></script>
<script language="javascript" src="<s:url value="/script/DateTimeMask.js"/>" type="text/javascript"></script>
<script type="text/javascript" src="<s:url value="/script/selfResize.js"/>"></script>

<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({autotip:true,onerror:function(msg){alert(msg)}});
	$("input:text[name='productReference.product.name']").formValidator({tipid:"producttip",onshow:"请选择产品"}).inputValidator({min:1,onerror:"您还没有选择产品",empty:{leftempty:false,rightempty:false,emptyerror:"产品名称两边不能有空符号"}});
	$("input:text[name='productReference.title']").formValidator({tipid:"titletip",onshow:"请输入资料标题"}).inputValidator({min:1,onerror:"您还没有输入资料标题",empty:{leftempty:false,rightempty:false,emptyerror:"标题两边不能有空符号"}});
	$("textarea[name='productReference.content']").formValidator({tipid:"contenttip",onshow:"请输入资料内容"}).inputValidator({onerror:"您还没有输入资料内容",min:1,max:300,onerror:"您输入的描述长度不能小于1和大于100字。"});
});
</script>

<link rel="stylesheet" href="<s:url value="/css/style_new.css"/>">
<link rel="stylesheet" href="<s:url value="/css/validator.css"/>">
<link href="<s:url value="/images/08_ccxxzx.css"/>" rel="stylesheet" type="text/css" />
</head>
	<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
		<table width="980" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="0"
						background="<s:url value="/images/new/gxzl_index_2.gif"/>">
						<tr>
							<td width="20" height="32">
								&nbsp;
							</td>
							<td width="20">
								<img src="<s:url value="/images/new/dq_dot.gif"/>" width="15"
									height="12" />
							</td>
							<td>
								当前位置：<font color="#003399">产品资料</font>
							</td>
							<td width="60">
							</td>
							<td width="200">
							</td>
							<td width="100">
							</td>
						</tr>
					</table>
				</td>
			</tr>
	<tr>
		<td background="<s:url value="/images/home_4a.gif"/>">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
			<tr>
				<td width="20%" valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
        <tr>

          <td valign="top">
								<s:form id="form1" action="saveAnnex.action"
									namespace="/business/catalog" enctype="multipart/form-data"
									onsubmit="return ($.formValidator.pageIsValid('1')&&save());"
									method="post">

							<input type="hidden" name="productReference.id" value="${productReference.id}">
							<input type="hidden" name="productReference.keyword" id="productReference.keyword" value="${productReference.keyword}" >
							<table align="center" width="90%" border="0" cellspacing="0" cellpadding="0" >
								<br/>
								<tr>
									<td height="5">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="5" height="5"><img src="<s:url value="/images/cphdzx_tab1.gif"/>" width="5" height="5" /></td>
												<td class="tdborderup"><img src="<s:url value="/images/spacer.gif"/>" width="1" height="1" /></td>
												<td width="5"><img src="<s:url value="/images/cphdzx_tab2.gif"/>" width="5" height="5" /></td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td class="tdborderleftright">
									<TABLE width="90%" cellSpacing=1 cellPadding=0 align="center">
										<TR height=30>
											<TD align=left width="10%">
												<input type="submit" id="Submit" name="Submit" value="保 存">
												<input type="button" value="返 回" onClick="location.href='<s:url value="/tmp/listAnnex.action"/>'">
											</TD>
										</TR>
									</table>
									<s:if test="#returnMsg==null">
									</s:if> <s:else>
										<TABLE width="90%" cellSpacing=1 cellPadding=0 align="center">
											<TR height=30>
												<TD align=left width="10%"><font color="red">${returnMsg}</font>
												</TD>
											</TR>
										</table>
									</s:else>
									<div class="validate"> 
									<table width="90%" border="0" cellspacing="0" cellpadding="7"
										align="center" class=tablecolor2>
										<tr>
											<td width="19%" bgcolor="D6E3FA">
											<div align="right"><font color="red">*</font>所属产品：</div>
											</td>
											<td width="81%">
												<input type="hidden" name="type" value="1">
												<input type="hidden" name="productReference.product.id"
													id="product_id" value="" readonly>
												<input type="text" name="productReference.product.name"
													id="product_name" value="" readonly>
												<input type="button" name="selType" value="选择产品"
													onClick="selectProduct()" />
												<div id="producttip" style="width:auto"></div>
											</td>
										</tr>
										<tr>
											<td width="19%" bgcolor="D6E3FA">
											<div align="right"><font color="red">*</font>资料类型：</div>
											</td>
											<td width="81%"><s:select
												name="productReference.referenceType.id" list="lRefType"
												listKey="id" listValue="name" theme="css_xhtml" /></td>
										</tr>
										<tr>
											<td width="19%" bgcolor="D6E3FA">
											<div align="right"><font color="red">*</font>标&nbsp;&nbsp;&nbsp;&nbsp;题：</div>
											</td>
											<td width="81%">
											<s:textfield
												name="productReference.title" theme="css_xhtml" size="64"/>
												<div id="titletip" style="width:auto"></div></td>
										</tr>
										<tr> 
											<td width="19%" bgcolor="D6E3FA">
											<div align="right"><font color="red">*</font>内&nbsp;&nbsp;&nbsp;&nbsp;容：</div>
											</td>
											<td width="81%"><s:textarea
												name="productReference.content" theme="css_xhtml" cols="50" rows="6"/>
												<div id="contenttip" style="width:auto"></div></td>
										</tr>
																<tr>
																	<td width="19%" bgcolor="D6E3FA">
																		<div align="right" class="STYLE2">
																			附&nbsp;&nbsp;&nbsp;&nbsp;件：
																		</div>
																	</td>
																	<td width="81%">
																		<table width="100%" border="0" class=tablecolor2>
																			<tr>
																				<td width="" align="center" bgcolor="D6E3FA">
																					附件名称
																				</td>
																			</tr>
																			<s:iterator value="annexList">
																				<input type="hidden" name="ids" value="<s:property value="id" />" />
																				<tr>
																					<td>
																						<s:property value="fullName" />
																					</td>
																				</tr>
																			</s:iterator>
																		</table>
																		<br />
																	</td>
																</tr>
										<tr>
											<td width="19%" bgcolor="D6E3FA">
											<div align="right">发布经理：</div>
											</td>
											<td width="81%"><input type="text" id="productReference.creator"
												name="productReference.creator" readonly value="${productReference.creator}">
											<input type="button" name="selType" value="选择人员"
												onClick="selectMainPerson()" /></td>
										</tr>

									</table>
									</div>
									</td>
								</tr>
								<tr>
								<td height="5">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td width="5" height="5"><img src="<s:url value="/images/cphdzx_tab3.gif"/>" width="5" height="5" /></td>
											<td class="tdborderbottom"><img src="<s:url value="/images/spacer.gif"/>" width="1" height="1" /></td>
											<td width="5"><img src="<s:url value="/images/cphdzx_tab4.gif"/>" width="5" height="5" /></td>
										</tr>
									</table>
								</td>
							</tr>
							</table>
							</td>
					</tr>
				</table>
				</s:form> 
</body>
</html>
<script>
<!--
	function uploadFile(id) {
		window
				.open(
						'<s:url value="/common/uploadFile.action?attach.refEntity=PRODUCTREFERENCE&attach.refEntityID=" escapeAmp="false"/>'
								+ id, "uploadfile",
						"dialogWidth=420px;dialogHeight=300px");
	}
	
	function addComponent()
	{
		var uploadHTML=document.createElement("<input type='file'　name='upload'/>");
		document.getElementById("files").appendChild(uploadHTML);
		uploadHTML=document.createElement("<p/>");
		document.getElementById("files").appendChild(uploadHTML);
	}

	function selectProduct(){
	     var url='<s:url value="/xtreecheckbox/selectProduct.jsp?module=radio&date=" escapeAmp="false"/>'+'<%=System.currentTimeMillis()%>';
	    // window.prompt("",url);
			var returnData = window.showModalDialog(url, window,
					"status:no;dialogWidth:800px;dialogHeight:600px;scroll:yes;");
			if (returnData) {
				document.forms[0]["productReference.product.name"].value = returnData[1];
				document.forms[0]["productReference.product.id"].value = returnData[0];
			}
	}

	function save(){
		var keyword=document.forms[0]['productReference.keyword'].value;
		if (keyword==""){
			var obj=document.forms[0]['productReference.referenceType.id'];
			keyword=document.forms[0]['productReference.product.name'].value
			+" "+obj.options[obj.selectedIndex].text;
			document.forms[0]['productReference.keyword'].value=keyword;
		}
		
		b_setDisable(document.getElementById("Submit"));
		return true;
	}
	
function selectMainPerson(){
    var url="<s:url value='/' escapeAmp='false'/>"+"organ/toOrganTree.action?type=&path=toPersonTree&module=radio&date=<%=System.currentTimeMillis()%>";	 
    var returnData=window.showModalDialog(url,window,"status:no;dialogWidth:650px;dialogHeight:600px;scroll:yes;");
	 if(returnData){
	 	document.all["productReference.creator"].value=returnData[1];
	 }
}


function loadPage(){
	if(document.readyState=="complete"){
	    f_iframeResize();
		clearTimeout(timeid);
	}else{
		var timeid=setTimeout("loadPage()",10);
	}
}
loadPage();

-->
</script>